<?php
/*
 * @Author: your name
 * @Date: 2020-12-23 12:01:16
 * @LastEditTime: 2020-12-28 10:11:16
 * @LastEditors: Please set LastEditors
 * @Description: 官方规则
 * @FilePath: /special/application/adminapiv3/controller/module_manage/hgshield/NormalRuleGroup.php
 */

namespace app\adminapiv3\controller;


class NormalRuleGroup extends BaseController
{
    /**
     * @name 官方规则组列表
     * @param $host_id
     * @author wx
     * @date 2019/11/12 13:14
     */
    public function list($host_id)
    {
        $params['name'] = $this->filterInput('name', 'get');
        $params['description'] = $this->filterInput('description', 'get');
        $params['status'] = $this->filterInput('status', 'get');

        $server = new \app\adminapiv3\service\NormalRuleGroup();
        $list = $server->toDo('list',[$host_id, $params]);

        $this->jsonOutPut($list);
    }

    /**
     * @name 启用
     * @param $host_id
     * @author wx
     * @date 2019/11/12 14:22
     */
    public function open($host_id)
    {
        $id = $this->filterInput('id*', 'post');
        $params['status'] = $this->filterInput('status*', 'post');

        $server = new \app\adminapiv3\service\NormalRuleGroup();
        $server->toDo('modify',[$host_id, $id, $params]);

        $this->jsonOutPut([],true);
        $this->Async('Hgshield', 'rules');
    }

    /**
     * @name 停用
     * @param $host_id
     * @author wx
     * @date 2019/11/12 14:28
     */
    public function close($host_id)
    {
        $id = $this->filterInput('id*', 'post');
        $params['status'] = $this->filterInput('status*', 'post');

        $server = new \app\adminapiv3\service\NormalRuleGroup();
        $server->toDo('modify',[$host_id, $id, $params]);

        $this->jsonOutPut([],true);
        $this->Async('Hgshield', 'rules');
    }

}